home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Nov 14 1996
- // Author: llm
- //
- // Description:
- // This script creates the contexts that are used to handle
- // the interactions of the tools. The tools will not work
- // without these contexts.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
- // Notes:
- //
- // All of the tool scripts need to have these contexts
- // created before the ui part can be created.
- //
- // *****************************************************************
- // WARNING WARNING WARNING WARNING WARNING WARNING
- //
- // Do not rename or remove anything from here without first
- // searching all scripts for references to these names! Just
- // because you put a context into the app does *not* mean that
- // you know everywhere it is being used.
- //
- // *****************************************************************
-
-
- global proc rememberCtxSettings( string $ctxName )
- //
- // This method sees if an optionVar has been defined
- // for the tool. If it has, the string it contains
- // is evaluated to set the tool settings. SuperContexts
- // should not be saved this way, since they have no
- // particular settings.
- //
- {
- if ( `optionVar -exists $ctxName` ){
- string $cmd = `optionVar -q $ctxName`;
- catch( `eval($cmd)` );
- } else {
- // create an empty option var so that this
- // will be saved.
- optionVar -sv $ctxName "";
- }
- }
-
-
- //global proc initContexts()
- {
- // Create Transform Tools
- global string $gSelect = "selectSuperContext";
- global string $gLasso = "lassoSelectContext";
- global string $gMove = "moveSuperContext";
- global string $gRotate = "RotateSuperContext";
- global string $gScale = "scaleSuperContext";
- global string $gMoveNormal = "MoveNormal";
- global string $gTransform = "Transform";
- global string $gMoveLimits = "MoveLimits";
- global string $gRotateLimits = "RotateLimits";
- global string $gScaleLimits = "ScaleLimits";
- global string $gPropMod = "PropMod";
- global string $gshowManip = "ShowManips";
-
- string $tumble = "tumbleContext";
- string $track = "trackSuperContext";
- string $dolly = "dollySuperContext";
-
- if (`isTrue "BaseMayaExists"`) {
- global string $gMainWindow;
-
- //
- // Create the contexts for the select tool
- //
- superCtx $gSelect;
-
- // Attach a modeling selection context
- rememberCtxSettings `selectContext nurbsSelect`;
- superCtx -edit -attach nurbsSelect $gSelect; // don't need to remember superContext settings
-
- // Attach a lasso pick context to the model views,
- // and the texture view
- //
- superCtx $gLasso;
- rememberCtxSettings `lassoContext SelectLasso`;
- superCtx -edit -attach SelectLasso $gLasso;
- rememberCtxSettings `textureLassoContext TextureLasso`;
- superCtx -edit -attach TextureLasso $gLasso;
-
- // Attach a hypergraph selection context
- // expSelectContext expSelectContext;
- // superCtx -edit -attach expSelectContext $gSelect;
-
- if (`isTrue "RenderingExists"`) {
- rememberCtxSettings `renderWindowSelectContext renderWindowSelectContextItem`;
- superCtx -edit -attach renderWindowSelectContextItem $gSelect;
- }
-
- //
- // Create the contexts for the move tool
- //
- superCtx $gMove;
-
- // Attach the manipulator move context
- rememberCtxSettings `manipMoveContext Move`;
- superCtx -edit -attach Move $gMove;
-
- // Create additional single channel manips
- //
- manipMoveContext -ah 0 manipTXContext;
- manipMoveContext -ah 1 manipTYContext;
- manipMoveContext -ah 2 manipTZContext;
-
- //
- // Create the context for the move normal tool
- //
- rememberCtxSettings `manipMoveContext -i1 "moveNormal.xpm" -mode 3 $gMoveNormal`;
-
- //
- // Create the contexts for the scale tool
- //
- superCtx $gScale;
-
- // Attach the manipulator scale context
- rememberCtxSettings `manipScaleContext Scale`;
- superCtx -edit -attach Scale $gScale ;
-
- // Create additional single channel manips
- // for scale
- //
- manipScaleContext -ah 0 manipSXContext;
- manipScaleContext -ah 1 manipSYContext;
- manipScaleContext -ah 2 manipSZContext;
-
- // Create contexts for manipulators
- //
- superCtx $gRotate;
-
- rememberCtxSettings `manipRotateContext Rotate`;
- superCtx -edit -attach Rotate $gRotate ;
-
- if (`isTrue "PolyTextureExists"`){
- rememberCtxSettings `texSelectContext transformTexSelectContext`;
- superCtx -edit -attach transformTexSelectContext $gSelect;
-
- rememberCtxSettings `texMoveContext texMoveContext`;
- superCtx -edit -attach texMoveContext $gMove;
-
- rememberCtxSettings `texScaleContext texScaleContext`;
- superCtx -edit -attach texScaleContext $gScale;
-
- rememberCtxSettings `texRotateContext texRotateContext`;
- superCtx -edit -attach texRotateContext $gRotate;
- }
-
- // Create additional single channel manips
- // for rotate
- //
-
- manipRotateContext -ah 0 manipRXContext;
- manipRotateContext -ah 1 manipRYContext;
- manipRotateContext -ah 2 manipRZContext;
-
- rememberCtxSettings `srtContext -i1 "srt.xpm" $gTransform`;
- rememberCtxSettings `manipMoveLimitsCtx -i1 "moveLimits.xpm" $gMoveLimits`;
- rememberCtxSettings `manipScaleLimitsCtx -i1 "scaleLimits.xpm" $gScaleLimits`;
- rememberCtxSettings `manipRotateLimitsCtx -i1 "rotateLimits.xpm" $gRotateLimits`;
- rememberCtxSettings `propModCtx -i1 "propMod.xpm" $gPropMod`;
-
- // Create the contexts for the showManip tool
- //
- superCtx $gshowManip;
-
- // Attach the show manipulator context
- //
- rememberCtxSettings `showManipCtx showManip3D`;
- superCtx -edit -attach showManip3D $gshowManip;
-
- if (`isTrue "PolyTextureExists"`){
- // Attach the texture view context
- //
- rememberCtxSettings `texManipContext showManipTextureContext`;
- superCtx -edit -attach showManipTextureContext $gshowManip;
- }
-
- scriptJob -permanent -parent $gMainWindow -event ToolChanged changeToolIcon;
-
- // Setup the Fly Through Context.
- //
- source "flyThroughContextSetup.mel";
-
- // Create the contexts for the Align Tool and the Snap Together Tool.
- //
- rememberCtxSettings `alignCtx -i1 "alignTool.xpm" alignToolCtx`;
- rememberCtxSettings `snapTogetherCtx -i1 "snapTogetherTool.xpm" snapTogetherToolCtx`;
- }
-
-
- //
- // Create Object Edit Tools
- //
- if (`isTrue "DeformersExists"`) {
- rememberCtxSettings `wireContext -i1 "wire.xpm" wireCtx`;
- rememberCtxSettings `wrinkleContext -i1 "wrinkle.xpm" wrinkleCtx`;
- rememberCtxSettings `setEditCtx -i1 "setEdit.xpm" setEditContext`;
- }
-
-
- if (`isTrue "BaseMayaExists"`) {
- //
- // Create View Tools
- //
- rememberCtxSettings `tumbleCtx -ac true -lt true -i1 "tumble.xpm" $tumble`;
-
- rememberCtxSettings `trackCtx -ac true trackContext`;
- superCtx -i1 "track.xpm" $track;
- superCtx -edit -attach trackContext $track;
-
- rememberCtxSettings `dollyCtx -ac true -ld true dollyContext`;
- superCtx -i1 "dolly.xpm" $dolly;
- superCtx -edit -attach dollyContext $dolly;
-
- rememberCtxSettings `orbitCtx -tn "Yaw-Pitch Tool" -i1 "yawPitch.xpm" yawPitchContext`;
- rememberCtxSettings `orbitCtx -lo true -tn "Azimuth Elevation Tool" -i1 "azimuthElevation.xpm" azimuthElevationContext`;
- rememberCtxSettings `rollCtx -i1 "roll.xpm" rollContext`;
-
- rememberCtxSettings `boxZoomCtx boxZoomContext`;
- superCtx -i1 "boxZoom.xpm" boxZoomSuperContext;
- superCtx -edit -attach boxZoomContext boxZoomSuperContext;
- }
-
- if (`isTrue "ExplorerExists"`) {
- if (`exists view2dToolCtx`) {
- rememberCtxSettings `view2dToolCtx -tr track2dContext`;
- superCtx -edit -attach track2dContext $track;
-
- rememberCtxSettings `view2dToolCtx -do dolly2dContext`;
- superCtx -edit -attach dolly2dContext $dolly;
-
- rememberCtxSettings `view2dToolCtx -bz boxZoom2dContext`;
- superCtx -edit -attach boxZoom2dContext boxZoomSuperContext;
- }
- }
-
- if (`isTrue "AnimationUIExists"`) {
- // Attach a graph editor selection context
- rememberCtxSettings `selectKeyCtx selectKeyContext`;
- superCtx -edit -attach selectKeyContext $gSelect;
-
- // Attach a selection context for keyframe region of the dope sheet
- rememberCtxSettings `keyframeRegionSelectKeyCtx keyframeRegionSelectKeyContext`;
- superCtx -edit -attach keyframeRegionSelectKeyContext $gSelect;
-
- // Attach a graph editor move context
- rememberCtxSettings `moveKeyCtx moveKeyContext`;
- superCtx -edit -attach moveKeyContext $gMove;
-
- // Attach a move context for the keyframe region of the dope sheet
- rememberCtxSettings `keyframeRegionMoveKeyCtx keyframeRegionMoveKeyContext`;
- superCtx -edit -attach keyframeRegionMoveKeyContext $gMove;
-
- // Attach a graph editor scale context
- rememberCtxSettings `scaleKeyCtx scaleKeyContext`;
- superCtx -edit -attach scaleKeyContext $gScale;
-
- // Attach a scale context for the keyframe region of the dope sheet
- rememberCtxSettings `keyframeRegionScaleKeyCtx keyframeRegionScaleKeyContext`;
- superCtx -edit -attach keyframeRegionScaleKeyContext $gScale;
-
- //
- // Create Animation Tools
- //
- // global string $gConstrainedMotion = "ConstrainedMotion";
-
- superCtx -i1 "directKey.xpm" directKeySuperContext;
- rememberCtxSettings `directKeyCtx directKeyContext`;
- superCtx -edit -attach directKeyContext directKeySuperContext;
- rememberCtxSettings `keyframeRegionDirectKeyCtx keyframeRegionDirectKeyContext`;
- superCtx -edit -attach keyframeRegionDirectKeyContext directKeySuperContext;
-
- superCtx -i1 "setKeySmall.xpm" setKeySuperContext;
- rememberCtxSettings `setKeyCtx setKeyContext`;
- superCtx -edit -attach setKeyContext setKeySuperContext;
- rememberCtxSettings `keyframeRegionSetKeyCtx keyframeRegionSetKeyContext`;
- superCtx -edit -attach keyframeRegionSetKeyContext setKeySuperContext;
-
- superCtx -i1 "insertKeySmall.xpm" insertKeySuperContext;
- rememberCtxSettings `insertKeyCtx insertKeyContext`;
- superCtx -edit -attach insertKeyContext insertKeySuperContext;
- rememberCtxSettings `keyframeRegionInsertKeyCtx keyframeRegionInsertKeyContext`;
- superCtx -edit -attach keyframeRegionInsertKeyContext insertKeySuperContext;
-
- // $startTime = `playbackOptions -q -min`;
- // $endTime = `playbackOptions -q -max`;
- // pathAnimationCtx -stu $startTime -etu $endTime pathAnimationContext;
- //
- // markerCtx -pm 1 -om 0 markerContext;
- //
- // constrainedMotionCtx $gConstrainedMotion;
-
- rememberCtxSettings `graphTrackCtx graphTrackContext`;
- superCtx -edit -attach graphTrackContext $track;
- rememberCtxSettings `keyframeRegionTrackCtx keyframeRegionTrackContext`;
- superCtx -edit -attach keyframeRegionTrackContext $track;
-
- rememberCtxSettings `graphDollyCtx graphDollyContext`;
- superCtx -edit -attach graphDollyContext $dolly;
- rememberCtxSettings `keyframeRegionDollyCtx keyframeRegionDollyContext`;
- superCtx -edit -attach keyframeRegionDollyContext $dolly;
- }
-
- if (`isTrue "PolyTextureExists"`){
-
- // Create texture window track,dolly,zoom contexts.
- //
- if (`exists texWinToolCtx`) {
- rememberCtxSettings `texWinToolCtx -tr tracktwContext`;
- superCtx -edit -attach tracktwContext $track;
-
- rememberCtxSettings `texWinToolCtx -do dollytwContext`;
- superCtx -edit -attach dollytwContext $dolly;
-
- rememberCtxSettings `texWinToolCtx -bz boxZoomtwContext`;
- superCtx -edit -attach boxZoomtwContext boxZoomSuperContext;
- }
-
- // Create bestPlaneTexturing Context
- //
-
- scriptCtx
- -i1 "bestPlaneTxt.xpm"
- -bcn "defaultTool"
-
- -title "Polygon Texturing Tool"
- -totalSelectionSets 2
- -cumulativeLists false
- -expandSelectionList true
- -exitUponCompletion true
- -fcs ("performBestPlaneTexturing " +
- "$Selection1 $Selection2")
-
- -setNoSelectionPrompt "Select one or more polygonal faces to map."
- -setSelectionPrompt ("Select additional polygonal faces to map " +
- "or press ENTER to begin defining the projection plane.")
- -setAutoToggleSelection true
- -setAutoComplete false
- -setSelectionCount 0
- -pf true
- -pv true
- -cv true
- -xyz true
- -setNoSelectionPrompt ("Select three or more vertices/CVs/Locators " +
- "to define the projection plane.")
- -setSelectionPrompt ("Select additional vertices/CVs/Locators to define the " +
- "projection plane or press Enter to " +
- "compute the UVs.")
- -setAutoToggleSelection true
- -setAutoComplete false
- -setSelectionCount 0
- -pf true
- -pv true
- -cv true
- -xyz true
- polyBestPlaneTexturingContext;
-
- //
- // Create PolyEdit Tools
- //
- rememberCtxSettings `polyCreateFacetCtx -i1 "polyCreateFacet.xpm" polyCreateFacetContext`;
- rememberCtxSettings `polyAppendFacetCtx -i1 "polyAppendFacet.xpm" polyAppendFacetContext`;
- rememberCtxSettings `polySplitCtx -i1 "polySplitFacet.xpm" polySplitContext`;
- rememberCtxSettings `polyMergeEdgeCtx -i1 "polyMergeEdge.xpm" polyMergeEdgeContext`;
- rememberCtxSettings `polyMergeFacetCtx -i1 "polyMergeFacet.xpm" polyMergeFacetContext`;
- rememberCtxSettings `polyCutCtx -i1 "polyCut.xpm" polyCutContext`;
- }
-
- // Create Dynamics Tools
- int $dynamicsIsLicensed = `licenseCheck -mode "edit" -type "fx"`;
-
- if (`isTrue "DynamicsUIExists"` && $dynamicsIsLicensed) {
- string $dynName;
- if ( !catch( $dynName = `dynParticleCtx -i1 "particle.xpm" dynParticleContext` ) ){
- rememberCtxSettings $dynName;
- }
- }
-
- if (`isTrue "KinematicsExists"`) {
- //
- // Create Kinematics Tools
- //
- rememberCtxSettings `jointCtx -i1 "kinJoint.xpm" jointContext`;
- rememberCtxSettings `ikHandleCtx -i1 "kinHandle.xpm" ikHandleContext`;
- rememberCtxSettings `ikSplineHandleCtx -i1 "kinSplineHandle.xpm" ikSplineHandleContext`;
- rememberCtxSettings `insertJointCtx -i1 "kinInsert.xpm" insertJointContext`;
- rememberCtxSettings `createDrawCtx createDrawContext`;
- }
-
- if (`isTrue "DimensionsExists"`) {
- //
- // Create Dimension Tools
- //
- rememberCtxSettings `distanceDimContext -i1 "distanceDim.xpm" distanceDimContext`;
- rememberCtxSettings `paramDimContext -i1 "paramDim.xpm" paramDimContext`;
- rememberCtxSettings `arcLenDimContext -i1 "arcLengthDim.xpm" arcLenDimContext`;
- }
-
- if (`isTrue "RenderingExists"`) {
- //
- // Create Rendering Tools
- //
- texturePlacementContext -i1 "texturePlacement.xpm" defaultTexturePlacementContext;
- projectionContext -image1 "polyInteractiveTexturePlacement.xpm" shadingProjectionContext;
- shadingGeometryRelCtx -onc "allListerEditorsSelectMode true"
- -ofc "allListerEditorsSelectMode false"
- -i1 "shadingGroupList32x32.xpm"
- shadingGeometryRelContext;
- shadingLightRelCtx -onc "allListerEditorsSelectMode true"
- -ofc "allListerEditorsSelectMode false"
- -i1 "lightLinkList32x32.xpm"
- shadingLightRelContext;
- }
-
- if (`isTrue "MayaCreatorExists"`) {
- global string $gCreatorWireCtx;
- $gCreatorWireCtx = `dynWireCtx`;
- rememberCtxSettings $gCreatorWireCtx;
- }
- }
-